function getFormatDate(separator = "_") {
  const today = new Date();
  const dayOfWeek = today.getDay(); // 0 (Sunday) to 6 (Saturday)

  if (dayOfWeek === 0) {
    // 如果今天是周日
    const thisMonday = new Date(today);
    thisMonday.setDate(today.getDate() - 6); // 往回推6天得到这周一的日期

    // 返回两个日期
    return [formatDate(today, separator), formatDate(thisMonday, separator)];
  } else {
    // 返回今天日期
    return [formatDate(today, separator)];
  }
}

function formatDate(data, separator = "_") {
  return `${data.getFullYear()}${separator}${
    data.getMonth() + 1
  }${separator}${data.getDate()}`;
}

module.exports = getFormatDate;
